import 'package:cbec_app/entity/home/content/content_data.dart';
import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/coupon_decoration_entity.g.dart';
import 'dart:convert';
export 'package:cbec_app/generated/json/coupon_decoration_entity.g.dart';

@JsonSerializable()
class CouponDecorationEntity extends ContentData {
  int? layout = 0;
  @JSONField(name: "coupon_source")
  String? couponSource = '';
  @JSONField(name: "hide_empty_coupon")
  String? hideEmptyCoupon = '';
  List<CouponDecorationCoupon>? coupon = [];
  @JSONField(name: "coupon_num")
  int? couponNum = 0;
  @JSONField(name: "hide_unshared_coupon")
  String? hideUnsharedCoupon = '';
  @JSONField(name: "coupon_show")
  int? couponShow = 0;
  @JSONField(name: "coupon_color")
  int? couponColor = 0;
  @JSONField(name: "coupon_style")
  int? couponStyle = 0;
  String? uuid = '';

  CouponDecorationEntity() {
    type = 'coupon';
  }

  factory CouponDecorationEntity.fromJson(Map<String, dynamic> json) => $CouponDecorationEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $CouponDecorationEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return CouponDecorationEntity.fromJson(json);
  }
}

@JsonSerializable()
class CouponDecorationCoupon {
  int? pageSize = 0;
  int? targetType = 0;
  String? remark = '';
  int? surplusNum = 0;
  String? marketingId = '';
  String? couponId = '';
  int? pageNum = 0;
  String? sid = '';
  String? shopNames = '';
  String? activityDate = '';
  int? totalNum = 0;
  int? useNum = 0;
  String? couponType = '';
  String? ruleType = '';
  String? name = '';
  int? receiveNum = 0;
  String? targetTypeName = '';
  String? syncOnline = '';
  int? status = 0;

  CouponDecorationCoupon();

  factory CouponDecorationCoupon.fromJson(Map<String, dynamic> json) => $CouponDecorationCouponFromJson(json);

  Map<String, dynamic> toJson() => $CouponDecorationCouponToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
